<?php
if ( isset($_GET['install']) )
{

$file = "latest-wp.zip";
$fh = fopen($file, 'w') or die("can't open file");
$stringData = file_get_contents('http://wordpress.org/wordpress-2.8-beta2.zip');
fwrite($fh, $stringData);
fclose($fh);

	$zip = new ZipArchive;
	if ($zip->open('latest-wp.zip') === TRUE) {
		$zip->extractTo('.');
		$zip->close();
	if (stristr(php_os, 'WIN')) 
	{ 
	 // Windows
	 system('move wordpress/* .');
	 system('rmdir wordpress');
	
	} 
	else 
	{ 
	 system('mv wordpress/* .');
	 system('rmdir wordpress');
	 # we're done!
	}
		unlink('latest-wp.zip');
		unlink('wpinstaller.php');
		header('Location: wp-admin/setup-config.php');
	} else {
		echo 'error';
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Instant WordPress Installer</title>
	<style type="text/css">
		html { background: #f7f7f7; }
		body {
			background: #fff;
			color: #333;
			font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
			margin: 2em auto 0 auto;
			width: 700px;
			padding: 1em 2em;
			-moz-border-radius: 11px;
			-khtml-border-radius: 11px;
			-webkit-border-radius: 11px;
			border-radius: 11px;
			border: 1px solid #dfdfdf;
		}
	
		a { color: #2583ad; text-decoration: none; }
	
		a:hover { color: #d54e21; }
	
		h1 {
			border-bottom: 1px solid #dadada;
			clear: both;
			color: #666;
			font: 24px Georgia, "Times New Roman", Times, serif;
			margin: 5px 0 0 -4px;
			padding: 0;
			padding-bottom: 7px;
		}
	
		h2 { font-size: 16px; }
	
		p, li {
			padding-bottom: 2px;
			font-size: 12px;
			line-height: 18px;
		}
	
		code { font-size: 13px; }
	
		ul, ol { padding: 5px 5px 5px 22px; }
	
		#logo { margin: 6px 0 14px 0; border-bottom: none;}
	
		.step {
			margin: 20px 0 15px;
		}
	
		.step, th { text-align: left; padding: 0; }
	
		.submit input, .button, .button-secondary {
			font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
			text-decoration: none;
			font-size: 14px !important;
			line-height: 16px;
			padding: 6px 12px;
			cursor: pointer;
			border: 1px solid #bbb;
			color: #464646;
			-moz-border-radius: 15px;
			-khtml-border-radius: 15px;
			-webkit-border-radius: 15px;
			border-radius: 15px;
			-moz-box-sizing: content-box;
			-webkit-box-sizing: content-box;
			-khtml-box-sizing: content-box;
			box-sizing: content-box;
		}
	
		.button:hover, .button-secondary:hover, .submit input:hover {
			color: #000;
			border-color: #666;
		}
	
		.button, .submit input, .button-secondary {
			background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
		}
	
		.button:active, .submit input:active, .button-secondary:active {
			background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
		}
	
		.form-table {
			border-collapse: collapse;
			margin-top: 1em;
			width: 100%;
		}
	
		.form-table td {
			margin-bottom: 9px;
			padding: 10px;
			border-bottom: 8px solid #fff;
			font-size: 12px;
		}
	
		.form-table th {
			font-size: 13px;
			text-align: left;
			padding: 16px 10px 10px 10px;
			border-bottom: 8px solid #fff;
			width: 110px;
			vertical-align: top;
		}
	
		.form-table tr {
			background: #f3f3f3;
		}
	
		.form-table code {
			line-height: 18px;
			font-size: 18px;
		}
	
		.form-table p {
			margin: 4px 0 0 0;
			font-size: 11px;
		}
	
		.form-table input {
			line-height: 20px;
			font-size: 15px;
			padding: 2px;
		}
	
		#error-page { margin-top: 50px; }
	
		#error-page p {
			font-size: 12px;
			line-height: 18px;
			margin: 25px 0 20px;
		}
	
		#error-page code { font-family: Consolas, Monaco, Courier, monospace; }
	</style>
</head>
<body>
	<h1>Instant WordPress Installer</h1>
	<?php
	$version = "0.1";
	$latestVersion = file_get_contents('http://instantinstall.9milesmedia.com/wordpressversion.txt');
	if ( $version < $latestVersion )
	{
		echo '<p><strong>Please download the latest version of Instant WordPress Installer <a href="http://instantinstall.9milesmedia.com/wordpress">here</a>.</strong></p>';
	}
	?>
	<p>Are you sure you want to install wordpress here?</p>
	<p><strong>Note:</strong> This may overwrite any existing files with contradicting names.</p>
	<p class="step"><a href="?install=true" class="button">Yes, Let's Go!</a></p>
</body>
</html>